Package com.fsf.news.processor
Class NewsResponseProcessorTest
java.lang.Object
com.fsf.news.processor.NewsResponseProcessorTest
@ExtendWith(org.mockito.junit.jupiter.MockitoExtension.class)
class NewsResponseProcessorTest
extends Object
Unit tests for the NewsResponseProcessor class.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) com.fasterxml.jackson.databind.node.ArrayNode(package private) com.fasterxml.jackson.databind.JsonNode(package private) com.fasterxml.jackson.databind.ObjectMapper(package private) com.fasterxml.jackson.databind.node.ObjectNode(package private) com.fasterxml.jackson.databind.ObjectReader(package private) com.fsf.news.processor.NewsResponseProcessor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidTests that the processResponse method returns the expected results.(package private) voidTests that the processResponse method throws exceptionally from processing the response to an Article.(package private) voidTests that the processResponse method throws exceptionally from processing the response to a SearchResult.(package private) voidTests that the processSourceProfileResponses method throws ResponseProcessingException when article processing fails.(package private) voidTests that the processSourceProfileResponses method returns the expected results.(package private) voidTests that the processSourceProfileResponses method throws ResponseProcessingException when source processing fails.(package private) voidTests that the processSourceProfileResponses method returns a default source when the specified source is not found.(package private) voidTests that the processSourcesResponse method returns the expected results.(package private) voidTests that the processSourcesResponse method throws exceptionally from processing the response to a Source.(package private) voidTests that the processSourcesResponse method throws exceptionally from processing the response to a SourcesResult.
-
Field Details
-
responseProcessor
@InjectMocks com.fsf.news.processor.NewsResponseProcessor responseProcessor -
objectMapper
@Mock com.fasterxml.jackson.databind.ObjectMapper objectMapper -
objectReader
@Mock com.fasterxml.jackson.databind.ObjectReader objectReader -
jsonNode
@Mock com.fasterxml.jackson.databind.JsonNode jsonNode -
arrayNode
@Mock com.fasterxml.jackson.databind.node.ArrayNode arrayNode -
objectNode
@Mock com.fasterxml.jackson.databind.node.ObjectNode objectNode
-
-
Constructor Details
-
NewsResponseProcessorTest
NewsResponseProcessorTest()
-
-
Method Details
-
testProcessResponse
Tests that the processResponse method returns the expected results.- Throws:
IOException- If JSON processing fails
-
testProcessResponseExceptionArticle
@Test void testProcessResponseExceptionArticle() throws com.fasterxml.jackson.core.JsonProcessingExceptionTests that the processResponse method throws exceptionally from processing the response to an Article.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- If JSON processing fails
-
testProcessResponseExceptionSearchResult
Tests that the processResponse method throws exceptionally from processing the response to a SearchResult.- Throws:
IOException- If JSON processing fails
-
testProcessSourcesResponse
@Test void testProcessSourcesResponse() throws com.fasterxml.jackson.core.JsonProcessingExceptionTests that the processSourcesResponse method returns the expected results.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- If JSON processing fails
-
testProcessSourcesResponseExceptionSource
@Test void testProcessSourcesResponseExceptionSource() throws com.fasterxml.jackson.core.JsonProcessingExceptionTests that the processSourcesResponse method throws exceptionally from processing the response to a Source.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- If JSON processing fails
-
testProcessSourcesResponseExceptionSourcesResult
@Test void testProcessSourcesResponseExceptionSourcesResult() throws com.fasterxml.jackson.core.JsonProcessingExceptionTests that the processSourcesResponse method throws exceptionally from processing the response to a SourcesResult.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- If JSON processing fails
-
testProcessSourceProfileResponsesNormal
@Test void testProcessSourceProfileResponsesNormal() throws com.fasterxml.jackson.core.JsonProcessingExceptionTests that the processSourceProfileResponses method returns the expected results.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- If JSON processing fails
-
testProcessSourceProfileResponsesSourceNotFound
@Test void testProcessSourceProfileResponsesSourceNotFound() throws com.fasterxml.jackson.core.JsonProcessingExceptionTests that the processSourceProfileResponses method returns a default source when the specified source is not found.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- If JSON processing fails
-
testProcessSourceProfileResponsesArticleException
@Test void testProcessSourceProfileResponsesArticleException() throws com.fasterxml.jackson.core.JsonProcessingExceptionTests that the processSourceProfileResponses method throws ResponseProcessingException when article processing fails.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- If JSON processing fails
-
testProcessSourceProfileResponsesSourceException
@Test void testProcessSourceProfileResponsesSourceException() throws com.fasterxml.jackson.core.JsonProcessingExceptionTests that the processSourceProfileResponses method throws ResponseProcessingException when source processing fails.- Throws:
com.fasterxml.jackson.core.JsonProcessingException- If JSON processing fails
-